package com.cy.网络编程.tcp.test2;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.Socket;

public class ReceThread extends Thread{
    private Socket s;
    public ReceThread(Socket s){
        this.s = s;
    }
    @Override
    public void run() {
        while (true){
            try {
                InputStream in = s.getInputStream();
                BufferedReader br = new BufferedReader(new InputStreamReader(in));
                String s1 = br.readLine();
                System.out.println("接受的消息是:"+s1);
            } catch (IOException e) {
                e.printStackTrace();
            }

        }
    }
}
